package Class;
	import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import servlet.Servlet3;

import org.junit.Test;



	public class T3{
		private static final String String = null;
		private Connection conn=null;
		private Statement sm=null;
		private ResultSet rs=null;
		private String b=null;
		
		
		@Test
		public int test(String name,String pwd,String tel) throws ClassNotFoundException, SQLException{
			String url="jdbc:mysql://127.0.0.1:3306/wtf?"
					+ "useUnicode=true&amp;characterEncoding=utf-8";
			Class.forName("com.mysql.jdbc.Driver");
			conn=DriverManager.getConnection(url, "root","x5");
			sm=conn.createStatement();
//			String sql=" SELECT a.id,a.test "
	//+" from test a";
			StringBuilder sb=new StringBuilder(" SELECT a.`password` "
					+" from wtf_biao_denglu a where `name`='"+name+"';");
			System.out.println("sql="+sb.toString());
			rs=sm.executeQuery(sb.toString());
			List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
			while(rs.next()){
				String b=rs.getString("password");
				Map<String,Object> map1=new HashMap<String,Object>();
				map1.put("test", b);
				list.add(map1);
				System.out.println("password="+b);
			
           	if (b.equals(pwd)){
           		return 1;    
           	}else{
           		System.out.println(rs.getObject(1));
           		return 0;  
           	}
           }
			rs.close();
			sm.close();
			conn.close();
			return 1;
		}

}
